// components/thumbs/indexpage/index.js
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    indexpageimages: {
      type: [],
      value: [],
      observer: function (newVal, oldVal) {
      
        this._indexpageimagespropertyChange(newVal,oldVal);
   
     } // 属性被改变时执行的函数（可选），也可以写成在methods段中定义的方法名字符串, 如：'_propertyChange'

    },
    baseimgaeUrl: {
      type: String,
      value: ""
    },
    isdelete:{
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    urllist:[],
    staticUrl: app.globalData.staticUrl,
    isdelete:false,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    _indexpageimagespropertyChange:function(newVal,oldVal){
        var urllist = [];
        for(var index=0; index<newVal.length;index++){
          urllist.push(newVal[index].pic);
        }
        console.log("_indexpageimagespropertyChange");
        console.log(newVal);
        this.setData({
          urllist:urllist
        })
    },
    
   

    _imagepreview:function(event){
           
      var src = event.currentTarget.dataset.src;//获取data-src
      var imgList =this.data.urllist;//获取data-list
      //图片预览
      wx.previewImage({
      current: src, // 当前显示图片的http链接
      urls: imgList // 需要预览的图片http链接列表
      })
      },
      _deletepic:function(e) {
        console.log(e);
        const {file_id} = e.currentTarget.dataset;
        this.triggerEvent('deletepic',file_id);
    }
  },

  
})
